package com.example.demo.common.lbsgeo.pubsub;

import redis.clients.jedis.Jedis;

/**消息发布端
 * Created by li on 2016/4/16.
 */
public class PubClient {
    private Jedis jedis;
    public PubClient(String host,int port){
        jedis = new Jedis(host,port);
    }

    public PubClient(Jedis jedis){
        this.jedis=jedis;
    }

    public void pub(String channel,String message){
        jedis.publish(channel, message);
    }

    public void close(String channel){
        jedis.publish(channel, "quit");
        jedis.del(channel);//
    }
}
